<?php

namespace App\Model\Face;

use App\Model\BaseModel;

class CompareInfoModel extends BaseModel
{

	public $tableName = "sc_compare_info";

	/**
	 * 通过条件获取数据库里面的设备
	 * @auth   xiaozhi
	 * @param  array   $condition [description]
	 * @return [type]             [description]
	 */
	public function getInfoData($joinTable, $columns = '*', $condition = [], $page = 1, $limit =10, $order = ['A.id', 'desc'])
    {

		$this->withTotalCount()
		    ->field($columns)
		    ->order($order[0], $order[1])
		    ->alias('A')
			->join($joinTable.' as B','A.id=B.compareid','LEFT')
			->where($condition)
            ->page($page, $limit)
            ->all();
		

		$count = $this->lastQueryResult()->getTotalCount();
        $lists = $this->lastQueryResult()->getResult();

        // $list = $lastResult->getResult();
        return ['count' => $count, 'lists' => $lists];

	}

}